const co = require('co')
const fetch = require('node-fetch')

// co(function *() {
//   const res = yield fetch('https://api.douban.com/v2/movie/1291843')
//   const movie = yield res.json()
//   console.log(movie.summary)
// })
async function run (generate) {
  const gen = generate()
  const res = await gen.next().value
  const movie2 = await gen.next(res).value
  gen.next(movie2)
  // gen.next()
}
run(function *() {
  const res = yield fetch('https://api.douban.com/v2/movie/1291843')
  const movie = yield res.json()
  console.log(movie.summary)
  console.log(`
    夕阳漫不经心走下酒坊
    晚风路过陶坛吹散了酒香
    偷倒空的酒坛还挂在墙上
    猫咪抱着尾巴睡得好安详
    我记得你所有的模样
  `)
})